logind: fix getting property OnExternalPower via D-Bus
authorMichael Biebl <biebl@debian.org>
Wed, 12 Oct 2022 09:07:57 +0000 (11:07 +0200)
committerAdrian Bunk <bunk@debian.org>
Sun, 25 Aug 2024 19:05:15 +0000 (22:05 +0300)
commite39d5ebaa4d912d1bb781dbeeac81d7f61992fe5
treeb4c8611116a4868b477558b799a230e6363f1ce7
parentab8069976aa4eec78558fef2976fba66dda45feb
logind: fix getting property OnExternalPower via D-Bus

The BUS_DEFINE_PROPERTY_GET_GLOBAL macro requires a value as third
argument, so we need to call manager_is_on_external_power(). Otherwise
the function pointer is interpreted as a boolean and always returns
true:

```
$ busctl get-property org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager OnExternalPower
b true
$ /lib/systemd/systemd-ac-power  --verbose
no
```

Thanks: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021644
(cherry picked from commit 63168cb517a556b2f4f175b365f5a4b4c7e85150)

Gbp-Pq: Name logind-fix-getting-property-OnExternalPower-via-D-Bus.patch
src/login/logind-dbus.c